from flask import Flask, render_template,request
from pyecharts.charts import Bar
from pyecharts.charts import Geo
from pyecharts.charts import Map
from pyecharts.globals import ChartType, SymbolType
from pyecharts import options as opts
import pandas as pd
import matplotlib.pyplot as plt
import plotly as py
import plotly.graph_objs as go
import plotly.graph_objects as go
from function import payment
from pyecharts.faker import Faker
from pyecharts.charts import WordCloud
from pyecharts.charts import Grid, Liquid
from pyecharts.commons.utils import JsCode
from pyecharts.charts import Funnel
from pyecharts.faker import Faker
from picture import reli,hd,hn,hb,hz,xn,xb,gat,db,jingdian,gd,js,hain,bj,sc,gdr,bjr,jsr,hnr

app = Flask(__name__)


# 首页
@app.route('/')
def shouye():
    return render_template(
        "index.html"
    )

# 项目页
@app.route('/project')
def xiangmu():
	 # 各省旅游景点门票销售情况

    with open("geo_base.html", encoding="utf8", mode="r") as f:
        plot_all3 = "".join(f.readlines())

    
    with open("各省旅游景点门票销售情况.html", encoding="utf8", mode="r") as f:
        plot_all1 = "".join(f.readlines())

    with open("不同价位区间消费情况.html", encoding="utf8", mode="r") as f:
        plot_all2 = "".join(f.readlines())

    return render_template(
        "project.html",the_plot_all1 = plot_all1,the_plot_all2 = plot_all2,the_plot_all3=plot_all3
    )


# 2020年各地区五一旅游情况
@app.route('/zone')
def zone_travle():
	with open("华东地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

# 2020年各地区五一旅游情况
@app.route('/huanan')
def huanan_travle():
	with open("华南地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/huabei')
def huabei_travle():
	with open("华北地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/huazhong')
def huazhong_travle():
	with open("华中地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/xinan')
def xinan_travle():
	with open("西南地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/xibei')
def xibei_travle():
	with open("西北地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/dongbei')
def dongbei_travle():
	with open("东北地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/gangaotai')
def gangaotai_travle():
	with open("港澳台地区景点不同星级数量.html", encoding="utf8", mode="r") as f:
		plot_all4 = "".join(f.readlines())
		return render_template(
			"zone.html",the_plot_all4 = plot_all4
			)

@app.route('/sightseeing')
def sightseeing():
	with open("2020年五一期间全国最受欢迎的十大景点-漏斗图.html", encoding="utf8", mode="r") as f:
		plot_all8 = "".join(f.readlines())

	with open("2020年五一全国热门景点类型-词云图.html", encoding="utf8", mode="r") as f:
		plot_all5 = "".join(f.readlines())

	with open("四川省-最受小朋友们喜爱的十大景点.html", encoding="utf8", mode="r") as f:
		plot_all6 = "".join(f.readlines())

		return render_template(
			"sightseeing.html",the_plot_all5 = plot_all5,the_plot_all6=plot_all6,the_plot_all8=plot_all8
			)


@app.route('/guangdong')
def guangdong():
	with open("2020年五一期间全国最受欢迎的十大景点-漏斗图.html", encoding="utf8", mode="r") as f:
		plot_all8 = "".join(f.readlines())

	with open("2020年五一全国热门景点类型-词云图.html", encoding="utf8", mode="r") as f:
		plot_all5 = "".join(f.readlines())

	    # 条形图的绘制
	with open("广东省-最受小朋友们喜爱的十大景点.html", encoding="utf8", mode="r") as f:
		plot_all6 = "".join(f.readlines())

		return render_template(
			"sightseeing.html",the_plot_all5 = plot_all5,the_plot_all6 = plot_all6,the_plot_all8 = plot_all8
			)

@app.route('/beijing')
def beijing():
	with open("2020年五一期间全国最受欢迎的十大景点-漏斗图.html", encoding="utf8", mode="r") as f:
		plot_all8 = "".join(f.readlines())

	with open("2020年五一全国热门景点类型-词云图.html", encoding="utf8", mode="r") as f:
		plot_all5 = "".join(f.readlines())

	with open("北京省-最受小朋友们喜爱的十大景点.html", encoding="utf8", mode="r") as f:
		plot_all6 = "".join(f.readlines())

		return render_template(
			"sightseeing.html",the_plot_all5 = plot_all5,the_plot_all6 = plot_all6,the_plot_all8=plot_all8
			)

@app.route('/hainan')
def hainan():
	with open("2020年五一期间全国最受欢迎的十大景点-漏斗图.html", encoding="utf8", mode="r") as f:
		plot_all8 = "".join(f.readlines())

	with open("2020年五一全国热门景点类型-词云图.html", encoding="utf8", mode="r") as f:
		plot_all5 = "".join(f.readlines())

	with open("海南省-最受小朋友们喜爱的十大景点.html", encoding="utf8", mode="r") as f:
		plot_all6 = "".join(f.readlines())

		return render_template(
			"sightseeing.html",the_plot_all5 = plot_all5,the_plot_all6 = plot_all6,the_plot_all8=plot_all8
			)

@app.route('/jiangsu')
def jiangsu():
	with open("2020年五一期间全国最受欢迎的十大景点-漏斗图.html", encoding="utf8", mode="r") as f:
		plot_all8 = "".join(f.readlines())

	with open("2020年五一全国热门景点类型-词云图.html", encoding="utf8", mode="r") as f:
		plot_all5 = "".join(f.readlines())

	with open("江苏省-最受小朋友们喜爱的十大景点.html", encoding="utf8", mode="r") as f:
		plot_all6 = "".join(f.readlines())

		return render_template(
			"sightseeing.html",the_plot_all5 = plot_all5,the_plot_all6 = plot_all6,the_plot_all8=plot_all8
			)


@app.route('/rate')
def rate():
	with open("四川省-景点评价率水球图.html", encoding="utf8", mode="r") as f:
		plot_all7 = "".join(f.readlines())

		return render_template(
			"rate.html",the_plot_all7 = plot_all7
			)	

@app.route('/gd_rate')
def gd_rate():
	with open("广东省-景点评价率水球图.html", encoding="utf8", mode="r") as f:
		plot_all7 = "".join(f.readlines())

		return render_template(
			"rate.html",the_plot_all7 = plot_all7
			)	

@app.route('/bj_rate')
def bj_rate():
	with open("北京市-景点评价率水球图.html", encoding="utf8", mode="r") as f:
		plot_all7 = "".join(f.readlines())

		return render_template(
			"rate.html",the_plot_all7 = plot_all7
			)	

@app.route('/hn_rate')
def hn_rate():
	with open("海南省-景点评价率水球图.html", encoding="utf8", mode="r") as f:
		plot_all7 = "".join(f.readlines())

		return render_template(
			"rate.html",the_plot_all7 = plot_all7
			)	

@app.route('/js_rate')
def js_rate():
	with open("江苏省-景点评价率水球图.html", encoding="utf8", mode="r") as f:
		plot_all7 = "".join(f.readlines())

		return render_template(
			"rate.html",the_plot_all7 = plot_all7
			)	

if __name__ == '__main__':
    app.run(
        debug=True
    )

